package com.kun.log;

import static ch.qos.logback.core.pattern.color.ANSIConstants.*;

import ch.qos.logback.classic.Level;
import ch.qos.logback.classic.spi.ILoggingEvent;
import ch.qos.logback.core.pattern.color.ForegroundCompositeConverterBase;

/**
 * 自定义彩色日志
 * 
 * @author zjkorder (2018/2/1 16:43)
 */
public class KunHighlightingCompositeConverter extends ForegroundCompositeConverterBase<ILoggingEvent> {
	protected String getForegroundColorCode(ILoggingEvent event) {
		switch (event.getLevel().toInt()) {
			case Level.ERROR_INT:
				return RED_FG;
			case Level.WARN_INT:
				return YELLOW_FG;
			case Level.INFO_INT:
				return GREEN_FG;
			case Level.DEBUG_INT:
				return MAGENTA_FG;
			default:
				return null;
		}
	}
}
